import { Component, OnInit, ViewChild, ViewContainerRef, ComponentRef, ComponentFactoryResolver } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { LayoutComponent } from "../../../global/layout/layout.component";
import { RunningService } from 'app/pages/social/list/running/running.service';
import { PaginationModel } from 'app/widgets/pagination';
import { environment } from '../../../../../environments/environment';
import { SocialFileComponent } from "../../modal/file/file.component";
import * as flatpickr from 'flatpickr';
import { zh } from "flatpickr/dist/l10n/zh.js";
import * as _ from 'lodash';
import { Util } from 'app/common/util';
import { DataService } from '../../../../services/data.service';

@Component({
  selector: 'app-running',
  templateUrl: './running.component.html',
  styleUrls: ['./running.component.scss'],
  providers: [RunningService]
})
export class RunningComponent implements OnInit {
  // lodash
  public _: any = _;
  //所属地区
  public area: any;
  // 菜单数据
  public menuData: any;
  // 菜单权限set
  public menuResourceSet: any = [];

  // 续约组合文件模版
  @ViewChild("renewFile", { read: ViewContainerRef })
  renewFile: ViewContainerRef;
  renewFileComponent: ComponentRef<SocialFileComponent>;
  // 终止组合文件模版
  @ViewChild("terminationFile", { read: ViewContainerRef })
  terminationFile: ViewContainerRef;
  terminationFileComponent: ComponentRef<SocialFileComponent>;
  // 续约/终止审核组合文件模版
  @ViewChild("checkFile", { read: ViewContainerRef })
  checkFile: ViewContainerRef;
  checkFileComponent: ComponentRef<SocialFileComponent>;
  //  修改运作日期
  public runningData = {
    "dBegin": "",
    "nFundNo": ""
  }
  //分页列表list
  public socialList = [];
  // 列表是否全选
  public isCheckedAll: boolean = false;
  // 是否模态框查询
  public isQuery: any = false;
  // 年金分页列表post数据
  public getBody = {
    pageIndex: 1,
    pageSize: 10,
    sStatus: "yyz",
    sFundType: 6,
    sFullName: '',  //组合名称 
    sFundCode: '', //组合代码 
    sLinkPrincipalNo: '' //受托人
  }
  public postBody = {
    pageIndex: 1,
    pageSize: 10,
    sStatus: "yyz",
    sFundType: 6,
    sFullName: '',  //组合名称 
    sFundCode: '', //组合代码 
    sContractName: '',  //合同名称 
    sProductType: '',
    sIsAssetTransfer: '0',  //是否资产移交
    sInvestor: '', //移交投管人
    // dSign: '', //签约日期
    // dConfirm: '', //确认日期
    sRecordorgType: '', //备案机构
    sPlanNo: '', //产品登记号
    // dEffective: '', //生效日期
    // dBegin: '', //开始运作日期
    sTermType: '', //期限 
    // dEnd: '', //到期日
    sIsRenewal: '', //是否自动续约
    sLinkPrincipalNo: '', //受托人
    sManager: '', //账管人
    sPrincipal: '', //委托人
    sTrustee: '', //托管人
    sOtherInvestor: '', //其他投资管理人
    sProjectManager: '', //项目经理
    sManagerNo: '', //投资经理
    sBenchmark: '', //业绩比较基准
    sArea: '', //所属地区
    sIsContainRight: '', //是否含权类
    sConfirmationNo: '', //确认函号
    sEmissionObject: '', //发行对象
    sEmissionWay: '' //发行方式
  };
  //分页配置
  public socialListPageInfo: PaginationModel = {
    currentPageNum: 1,
    pageSize: 10,
    totalPages: 0,
    total: 0,
    pagesShow: 5,
    startRow: 0,
    endRow: 0,
    pageList: [5, 10, 25, 50, 100]
  };
  // 投资经理列表
  public ManagerList;
  // 项目经理列表
  public ProjectManagerList;
  // 移交投管人
  public sInvestorSelectList: any;
  // 其他投资管理人
  public investorSelectList: any;
  // 项目经理
  public managerSelectList: any;
  // 备案机构、受托人、托管人
  public distionary: any = {
    RECORDORG_TYPE: [],  // 备案机构
    LINK_PRINCIPAL_NO: [],   //受托人
    TRUSTEE: []   //  托管人
  }
  // 字典值
  public dictionaryList: any = {
    // RECORDORG_TYPE: [],  // 备案机构
    TERM_TYPE: [],   // 产品类别
    // LINK_PRINCIPAL_NO: [],   // 受托人
    // TRUSTEE: [],   // 托管人
    MANAGER: [],    // 账管人
    AREA: [],   // 所属地区
    OTHER_INVESTOR: [],  // 其他投资管理人、移交投管人
    EMISSION_WAY: [],  // 发行方式
    STOP_TYPE: [],
    SOCIAL_TYPE: []
  };
  // 续约/终止列表数据
  public renewList: any;
  public renewListClone: any;
  // 续约/终止列表全选
  public isRenewCheckedAll: any = false;
  // 续约/终止列表请求体
  public getRenewPost = {
    pageIndex: 1,
    pageSize: 10,
    sFundType: '6',
    prdName: '',
    prdCode: '',
    sType: '2'
  };
  // 续约/终止列表页配置
  public renewPageInfo: PaginationModel = {
    currentPageNum: 1,
    pageSize: 10,
    totalPages: 1,
    total: 0,
    pagesShow: 5,
    startRow: 0,
    endRow: 0,
    pageList: [5, 10, 25, 50, 100]
  };
  // 基础列表
  public basicList: any;
  // 基础列表请求体
  public getBasicPost = {
    pageIndex: 1,
    pageSize: 10,
    sStatus: 'yyz',
    sFundType: '6',
    sFundCode: '',
    sFullName: '',
    dEffective: '',
    dEnd: ''
  };
  // 基础列表分页配置
  public basicPageInfo: PaginationModel = {
    currentPageNum: 1,
    pageSize: 10,
    totalPages: 1,
    total: 0,
    pagesShow: 5,
    startRow: 0,
    endRow: 0,
    pageList: [5, 10, 25, 50, 100]
  };
  // 续约/终止新增
  public selectFundNo: any = '';
  // 续约模版数据
  public renewBody: any = {};
  // 终止模版数据
  public terminationBody: any = {};
  // 审核模版
  public checkBody: any = {};
  //续约终止管理判断业务状态
  public sAuditStatus: any;
  constructor(
    public resolver: ComponentFactoryResolver,
    public router: Router,
    public layoutComponent: LayoutComponent,
    public runningService: RunningService,
    public dataService: DataService
  ) { }

  ngOnInit() {
    let that = this;
    // 多选下拉框
    window['$'](".select2").select2();
    this.LoadProjectManagerList();
    this.LoadManagerList();
    // 权限处理
    this.dataService.initTree.subscribe(data => {
      if (data) {
        let SessionMenuData = sessionStorage.getItem('menu');
        this.menuData = JSON.parse(SessionMenuData);
        this.menuResourceSet = [];
        _.forEach(this.menuData, (item, index) => {
          if (item.sName == '社保基金') {
            _.forEach(item.children, (it, idx) => {
              if (it.sName == '运作中') {
                that.menuResourceSet = it.resourceSet;
                sessionStorage.setItem('btn-sf', this.menuResourceSet);
              }
            })
          }
        })
      }
    })
    let SessionMenuData = sessionStorage.getItem('menu');
    this.menuData = JSON.parse(SessionMenuData);
    this.menuResourceSet = [];
    _.forEach(this.menuData, (item, index) => {
      if (item.sName == '社保基金') {
        _.forEach(item.children, (it, idx) => {
          if (it.sName == '运作中') {
            that.menuResourceSet = it.resourceSet;
            sessionStorage.setItem('btn-sf', this.menuResourceSet);
          }
        })
      }
    })
    // 初始化日期控件
    flatpickr.localize(zh);
    // 字典值
    this.dictionaryList = JSON.parse(localStorage.getItem("dictionaryList"));
    this.getDictionary();
    this.list();
  }
  ngAfterViewInit() {
    let that = this;
    // 备案机构
    // window['$']('#sRecordorgTypeSelected').select2({ width: '190px', tags: true });
    // window['$']('#sRecordorgTypeSelected').on("select2:select", function (e) {
    //   that.postBody.sRecordorgType = window['$']('#sRecordorgTypeSelected').select2("val");
    // })
    // 期限
    window['$']('#sTermTypeSelected').select2({ width: '190px' });
    window['$']('#sTermTypeSelected').on("select2:select", function (e) {
      that.postBody.sTermType = window['$']('#sTermTypeSelected').select2("val");
      // 到期日计算
      // if (that.postBody.dEffective == '' || that.postBody.dEffective == null) {
      //   that.postBody.sTermType = '';
      // } else {
      //   if (that.postBody.sTermType == '' || that.postBody.sTermType == null) {
      //     that.postBody.dEnd = '';
      //   } else if (that.postBody.sTermType == '0') {
      //     that.postBody.dEnd = '';
      //     window['$']("#dEnd").attr("disabled", "disabled");
      //     window['$']("#dEnd").css("background", "#eee");
      //   } else {
      //     window['$']("#dEnd").removeAttr("disabled");
      //     window['$']("#dEnd").css("background", "white");
      //     that.postBody.dEnd = Util.dateIncrease(that.postBody.dEffective, that.postBody.sTermType);
      //   }
      // }
    })
    // 受托人
    window['$']('#sLinkPrincipalNoSelected').select2({ width: '190px', tags: true });
    window['$']('#sLinkPrincipalNoSelected').on("select2:select", function (e) {
      that.postBody.sLinkPrincipalNo = window['$']('#sLinkPrincipalNoSelected').select2("val");
    })
    window['$']('#sLinkPrincipalNoSelecteds').select2({ width: '190px', tags: true });
    window['$']('#sLinkPrincipalNoSelecteds').on("select2:select", function (e) {
      that.getBody.sLinkPrincipalNo = window['$']('#sLinkPrincipalNoSelecteds').select2("val");
    })
    // 账管人
    // window['$']('#sManagerSelected').select2({ width: '190px' });
    // window['$']('#sManagerSelected').on("select2:select", function (e) {
    //   that.postBody.sManager = window['$']('#sManagerSelected').select2("val");
    // })
    // 托管人
    window['$']('#sTrusteeSelected').select2({ width: '190px', tags: true });
    window['$']('#sTrusteeSelected').on("select2:select", function (e) {
      that.postBody.sTrustee = window['$']('#sTrusteeSelected').select2("val");
    })
    // 投资经理
    // window['$']('#sManagerNoSelected').select2({ width: '190px' });
    // window['$']('#sManagerNoSelected').on("select2:select", function (e) {
    //   that.postBody.sManagerNo = window['$']('#sManagerNoSelected').select2("val");
    // })
    // 所属地区
    // window['$']('#sAreaSelected').select2({ width: '190px' });
    // window['$']('#sAreaSelected').on("select2:select", function (e) {
    //   that.postBody.sArea = window['$']('#sAreaSelected').select2("val");
    // })
    // 组合类型
    window['$']('#sProductTypeSelected').select2({ width: '190px' });
    window['$']('#sProductTypeSelected').on("select2:select", function (e) {
      that.postBody.sProductType = window['$']('#sProductTypeSelected').select2("val");
    })
  }
  // 判断页面查询还是搜索框查询
  loadcheck(type: any) {
    if (type == 'query') {
      this.isQuery = true;
      this.list(1);
    }
    if (type == 'page') {
      this.isQuery = false;
      this.list(1);
    }
  }
  list(pageNum?, pageSize?) {
    let that = this;
    let body: any;
    this.isCheckedAll = false;
    // 判断是页面查询还是搜索框查询
    if (this.isQuery) {
      // 清空页面查询条件
      this.getBody.sFullName = '';
      this.getBody.sFundCode = '';
      this.getBody.sLinkPrincipalNo = '';
      window['$']('#sLinkPrincipalNoSelecteds').select2("val", '--请选择--');
      // 转换多选下拉框值
      this.postBody.sInvestor = Util.transferValue('.sInvestor-select');
      this.postBody.sOtherInvestor = Util.transferValue('.investor-select');
      this.postBody.sProjectManager = Util.transferValue('.manager-select');
      // this.postBody.sInvestor = this.ctrlsInvestor();
      // this.postBody.sOtherInvestor = this.ctrlInvestorId();
      // this.postBody.sProjectManager = this.ctrlManagerId();
      // 去空格
      _.forIn(this.postBody, (value, key) => {
        if (key == 'pageSize' || key == 'pageIndex' || key == 'sFundType') {
          // 这里不做处理，排除number类型
        } else {
          that.postBody[key] = _.trim(that.postBody[key]);
        }
      })
      this.postBody.pageIndex = pageNum ? pageNum : this.socialListPageInfo.currentPageNum;
      this.postBody.pageSize = pageSize ? pageSize : this.socialListPageInfo.pageSize
      body = _.cloneDeep(this.postBody);
    } else {
      // 去空格
      this.getBody.sFullName = _.trim(this.getBody.sFullName);
      this.getBody.sFundCode = _.trim(this.getBody.sFundCode);
      this.getBody.pageIndex = pageNum ? pageNum : this.socialListPageInfo.currentPageNum;
      this.getBody.pageSize = pageSize ? pageSize : this.socialListPageInfo.pageSize
      body = _.cloneDeep(this.getBody);
    }
    this.runningService.list(body).subscribe(data => {
      if (data) {
        that.socialList = data.list;
        that.socialListPageInfo.currentPageNum = data.pageNum;
        that.socialListPageInfo.totalPages = data.pages;
        that.socialListPageInfo.total = data.total;
        that.socialListPageInfo.startRow = data.startRow;
        that.socialListPageInfo.endRow = data.endRow;
        window['$']('#socialRunQuery').modal('hide');
        // // 给表格列支持列拖动效果
        // setTimeout(() => {
        //   Util.colResizable("#fixed-table");
        // }, 100);
        // 给表格列支持列拖动和固定表头效果
        Util.colResizable("#runningList");
      }
    });
  }
  // 个数分页
  socialpageSizeChange(pageSize: number) {
    if (pageSize !== this.socialListPageInfo.pageSize) {
      this.socialListPageInfo.pageSize = pageSize;
      this.list();
    }
  }
  // 页码分页
  socialPageNavigation(currentPageNum: number) {
    this.socialListPageInfo.currentPageNum = currentPageNum;
    this.list(this.socialListPageInfo.currentPageNum, this.socialListPageInfo.pageSize);
  }
  // 列表全选
  checkedAll() {
    if (this.isCheckedAll) { // 更新为全选
      _.forEach(this.socialList, item => {
        item.isChecked = true;
      });
    } else { // 更新为不全选
      _.forEach(this.socialList, item => {
        item.isChecked = false;
      });
    }
  }
  // 列表是否全选
  ctrlCheckAll() {
    let that = this;
    let checkList = [];
    _.forEach(this.socialList, item => {
      if (item.isChecked == true) {
        checkList.push(item);
      }
    })
    if (checkList.length == this.socialList.length) {
      this.isCheckedAll = true;
    } else {
      this.isCheckedAll = false;
    }
  }
  // 删除组合
  delProduct() {
    let that = this;
    let checkedItem = [];
    let checkedFundName = [];
    _.forEach(that.socialList, item => {
      if (item.isChecked == true) {
        checkedItem.push(item.nFundNo);
        checkedFundName.push(item.sFullName);
      }
    })
    let checkedTips = checkedFundName.join("、");
    if (checkedItem.length > 0) {
      window['swal']({
        type: "warning",
        showCancelButton: true,
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        closeOnConfirm: false,
        showLoaderOnConfirm: true,
        title: "提示",
        text: "<div style='max-height: 200px;overflow-y: auto;'>" + "请确认是否删除组合：" + checkedTips + "</div>",
        html: true
      }, function (isConfirm) {
        if (isConfirm) {
          let putBody: any = {
            "nFundNos": checkedItem
          }
          that.runningService.del(putBody).subscribe(data => {
            if (data) {
              window['swal']("删除成功！", "", "success")
              that.list();
            }
          })
        }
      });
    }
    else {
      window['swal']("提示", "请选择一个或多个组合进行删除", "warning")
    }
  }
  // 编辑组合信息
  edit(type, item?) {
    // let that = this;
    // sessionStorage.setItem('parentIndex', 'wyz');
    // // 组合修改勾选
    // let checkProduct = [];
    // switch (type) {
    //   case 'dbclick':
    //     sessionStorage.setItem('currentTitle', "详情·未运作·社保基金");
    //     that.layoutComponent.nav(null, null, "详情·未运作·社保基金");
    //     that.router.navigate(['pages/social/not-running/detail/edit/' + item.nFundNo]);
    //     break;
    //   case 'one':
    //     _.forEach(that.socialList, it => {
    //       if (it.isChecked == true) {
    //         checkProduct.push(it);
    //         console.info(checkProduct);
    //       }
    //     })
    //     if (checkProduct.length < 1) {
    //       window['swal']("提示", "请选择一个组合进行查看", "warning");
    //     }
    //     if (checkProduct.length == 1) {
    //       sessionStorage.setItem('currentTitle', "详情·未运作·社保基金");
    //       that.layoutComponent.nav(null, null, "详情·未运作·社保基金");
    //       that.router.navigate(['pages/social/not-running/detail/edit/'+ checkProduct[0].nFundNo]);
    //     }
    //     if (checkProduct.length > 1) {
    //       window['swal']("提示", "请选择一个组合进行查看", "warning");
    //     }
    //     break;
    // }

    let that = this;
    sessionStorage.setItem('parentIndex', 'yyz');
    // 组合修改勾选
    let checkProduct = [];
    switch (type) {
      case 'dbclick':
        sessionStorage.setItem('currentTitle', "详情·运作中·社保");
        that.layoutComponent.nav(null, null, "详情·运作中·社保");
        that.router.navigate(['pages/social/running/detail/edit/' + item.nFundNo]);
        break;
      case 'one':
        _.forEach(that.socialList, it => {
          if (it.isChecked == true) {
            checkProduct.push(it);
          }
        })
        if (checkProduct.length < 1) {
          window['swal']("提示", "请选择一个组合进行查看", "warning");
        }
        if (checkProduct.length == 1) {
          sessionStorage.setItem('currentTitle', "详情·运作中·社保");
          that.layoutComponent.nav(null, null, "详情·运作中·社保");
          that.router.navigate(['pages/social/running/detail/edit/' + checkProduct[0].nFundNo]);
        }
        if (checkProduct.length > 1) {
          window['swal']("提示", "请选择一个组合进行查看", "warning");
        }
        break;
    }

  }
  // 导出
  exportExcel() {
    // let that = this;
    // let checkedItem = [];
    // _.forEach(that.socialList, item => {
    //   if (item.isChecked == true) {
    //     checkedItem.push(item.nFundNo);
    //   }
    // })
    // let converItem: any = checkedItem.join(',');
    // let getBody = {
    //   "nFundNoList": converItem,
    //   "sStatus": 'yyz',
    //   "sFundType": 6,
    //   "sFullName": '',
    //   "sFundCode": '',
    // }
    // const iframe = window['$']("<iframe id='downloadiframe'>");
    // iframe.attr('style', 'display:none');
    // //  转码，兼容ie
    // getBody.sFullName = encodeURI(getBody.sFullName)
    // iframe.attr('src', environment.server + '/pms/v1/pension/basicInfo/export/pensionDeptList?token=' + sessionStorage.getItem('token') + '&nFundNoList=' + getBody.nFundNoList + '&sStatus=' + getBody.sStatus + '&sFundType=' + getBody.sFundType + '&sFundCode=' + getBody.sFundCode);
    // window['$']('body').append(iframe);
    // setTimeout("$('#downloadiframe').remove()", 60000);
    let that = this;
    let checkedItem = [];
    let postBody: any;
    _.forEach(this.socialList, item => {
      if (item.isChecked) {
        checkedItem.push(item.nFundNo);
      }
    })
    let converItem = checkedItem.join(",");
    // 请求body
    if (this.isQuery) {
      postBody = _.cloneDeep(this.postBody);
      postBody['nFundNoList'] = checkedItem;
      delete postBody.pageIndex;
      delete postBody.pageSize;
    } else {
      postBody = {
        "nFundNoList": checkedItem,
        "sFullName": this.getBody.sFullName,
        "sFundCode": this.getBody.sFundCode,
        "sFundType": this.getBody.sFundType,
        "sStatus": this.getBody.sStatus,
        "sLinkPrincipalNo": this.getBody.sLinkPrincipalNo
      }
    }
    // 请求Url
    let postUrl = environment.server + '/pms/v1/pension/basicInfo/export/pensionDeptList?token=' + sessionStorage.getItem('token');
    // 导出
    this.runningService.exportTarget(postUrl, postBody, '社保基金组合列表-运作中');
  }
  //  显示修改运作日期模态框
  showRunModal() {
    let that = this;
    let checkProduct = [];
    _.forEach(this.socialList, item => {
      if (item.isChecked) {
        checkProduct.push(item);
      }
    });
    if (checkProduct.length == 1) {
      this.runningData = _.clone(checkProduct[0]);
      window['$']("#running").modal('show');
    } else {
      window['swal']("提示", "请选择一个组合进行运作日期修改", "warning");
    }
  }
  // 修改运作日期
  changeRunningData() {
    let that = this;
    if (this.runningData.dBegin == '' || this.runningData.dBegin == null) {
      window['swal']("提示", "请选择日期", "warning");
    } else {
      let putBody: any = {
        nFundNo: this.runningData.nFundNo,
        dBegin: this.runningData.dBegin
      }
      this.runningService.changeRunningData(putBody).subscribe(data => {
        if (data) {
          window['$']("#running").modal('hide');
          window['swal']("成功", "运作日期修改成功", "success");
          that.list();
        }
      });
    }
  }
  // 续约/终止管理
  goRenew() {
    this.getRenewList();
  }
  // 续约/终止列表
  getRenewList(pageNum?, pageSize?) {
    let that = this;
    this.isRenewCheckedAll = false;
    this.getRenewPost.prdName = _.trim(this.getRenewPost.prdName);
    this.getRenewPost.prdCode = _.trim(this.getRenewPost.prdCode);
    this.getRenewPost.pageIndex = pageNum ? pageNum : this.renewPageInfo.currentPageNum;
    this.getRenewPost.pageSize = pageSize ? pageSize : this.renewPageInfo.pageSize;
    this.runningService.getRenewList(this.getRenewPost).subscribe(data => {
      if (data) {
        that.renewList = data.list;
        that.renewListClone = _.cloneDeep(data.list);
        that.renewPageInfo.currentPageNum = data.pageNum;
        that.renewPageInfo.totalPages = data.pages;
        that.renewPageInfo.total = data.total;
        that.renewPageInfo.startRow = data.startRow;
        that.renewPageInfo.endRow = data.endRow;
      }
    });
  }
  // 续约/终止个数分页
  renewpageSizeChange(pageSize: number) {
    if (pageSize !== this.renewPageInfo.pageSize) {
      this.renewPageInfo.pageSize = pageSize;
      this.getRenewList();
    }
  }
  // 续约/终止条数分页
  renewPageNavigation(currentPageNum: number) {
    this.renewPageInfo.currentPageNum = currentPageNum;
    this.getRenewList(this.renewPageInfo.currentPageNum, this.renewPageInfo.pageSize);
  }
  // 续约/终止列表全选
  renewCheckedAll() {
    if (this.isRenewCheckedAll) {
      _.forEach(this.renewList, item => {
        item.isChecked = true;
      });
    } else {
      _.forEach(this.renewList, item => {
        item.isChecked = false;
      });
    }
  }
  // 续约/终止列表是否全选
  ctrlRenewCheckAll() {
    let that = this;
    let checkList = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked == true) {
        checkList.push(item);
      }
    })
    if (checkList.length == this.renewList.length) {
      this.isRenewCheckedAll = true;
    } else {
      this.isRenewCheckedAll = false;
    }
  }
  // 获取基础列表数据
  getBasicList(pageNum?, pageSize?) {
    let that = this;
    this.selectFundNo = '';
    this.getBasicPost.sFundCode = _.trim(this.getBasicPost.sFundCode);
    this.getBasicPost.sFullName = _.trim(this.getBasicPost.sFullName);
    this.getBasicPost.pageIndex = pageNum ? pageNum : this.basicPageInfo.currentPageNum;
    this.getBasicPost.pageSize = pageSize ? pageSize : this.basicPageInfo.pageSize;
    this.runningService.getBasicList(this.getBasicPost).subscribe(data => {
      if (data) {
        that.basicList = data.list;
        that.basicPageInfo.currentPageNum = data.pageNum;
        that.basicPageInfo.totalPages = data.pages;
        that.basicPageInfo.total = data.total;
        that.basicPageInfo.startRow = data.startRow;
        that.basicPageInfo.endRow = data.endRow;
      }
    })
  }
  // 基础个数分页
  basicpageSizeChange(pageSize: number) {
    if (pageSize !== this.basicPageInfo.pageSize) {
      this.basicPageInfo.pageSize = pageSize;
      this.getBasicList();
    }
  }
  // 基础页码分页
  baiscPageNavigation(currentPageNum: number) {
    this.basicPageInfo.currentPageNum = currentPageNum;
    this.getBasicList(this.basicPageInfo.currentPageNum, this.basicPageInfo.pageSize);
  }
  // 续约/终止新增modal
  add() {
    this.getBasicList();
    window['$']("#add").modal('show');
  }
  // 续约/终止新增选择
  selectItem(nFundNo) {
    this.selectFundNo = nFundNo;
  }
  // 续约/终止新增保存
  addRenew() {
    let that = this;
    if (this.selectFundNo == '') {
      window['swal']("提示", "请选择一条组合进行添加!", "warning");
    } else {
      window['swal']({
        type: "warning",
        showCancelButton: true,
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        closeOnConfirm: false,
        showLoaderOnConfirm: true,
        title: "提示",
        text: "是否确认添加该条流水记录?",
        html: true
      },
        function (isConfirm) {
          if (isConfirm) {
            that.runningService.addRenew(that.selectFundNo).subscribe(data => {
              if (data) {
                window['$']("#add").modal('hide');
                window['swal']("成功", "添加成功", "success");
                that.getRenewList();
                that.selectFundNo = '';
              }
            })
          }
        })
    }
  }
  // 续约/终止修改
  change() {
    let that = this;
    let checkProduct = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked == true) {
        checkProduct.push(item);
      }
    })
    if (checkProduct.length == 1) {
      // 业务类型填上并且审核状态不为”已审核”的记录才能进行修改
      this.sAuditStatus = checkProduct[0].sAuditStatus;
      if (checkProduct[0].sType == 2 || checkProduct[0].sType == 4) {
        if (checkProduct[0].sAuditStatus == 1) {
          window['swal']("提示", "审核通过的数据不可修改", "warning");
        } else if (checkProduct[0].sAuditStatus == 2) {
          window['swal']("提示", "打回的数据不可修改", "warning");
        } else {
          // 续约
          this.renewBody = _.cloneDeep(checkProduct[0]);
          // 用于控制新的到期日禁用
          if (this.renewBody.sTermType == '0') {
            this.renewBody.dNewEnd = '';
            window['$']("#dNewEnd").attr("disabled", "disabled");
            window['$']("#dNewEnd").css("background", "#eee");
          } else {
            window['$']("#dNewEnd").removeAttr("disabled");
            window['$']("#dNewEnd").css("background", "white");
          }
          this.showRenewFile(checkProduct[0]);
          window['$']("#renew").modal('show');
        }
      } else {
        window['swal']("提示", "请选择续约状态的数据进行操作", "warning");
      }
    } else {
      window['swal']("提示", "请选择一条数据进行修改", "warning");
    }
  }
  // 续约modal
  showRenew(item) {
    this.sAuditStatus = item.sAuditStatus;
    this.renewBody = _.clone(item);
    // 用于控制新的到期日禁用
    if (this.renewBody.sTermType == '0') {
      this.renewBody.dNewEnd = '';
      window['$']("#dNewEnd").attr("disabled", "disabled");
      window['$']("#dNewEnd").css("background", "#eee");
    } else {
      window['$']("#dNewEnd").removeAttr("disabled");
      window['$']("#dNewEnd").css("background", "white");
    }
    this.showRenewFile(item);
    window['$']("#renew").modal('show');
  }
  // 续约期限增加
  termContrl() {
    if (this.renewBody.dNewBegin == '' || this.renewBody.dNewBegin == null) {
      window['swal']("提示", "请填写新的开始日期", "warning");
      this.renewBody.sTermType = '';
    } else {
      if (this.renewBody.sTermType == '0') {
        this.renewBody.dNewEnd = '';
        window['$']("#dNewEnd").attr("disabled", "disabled");
        window['$']("#dNewEnd").css("background", "#eee");
      } else {
        window['$']("#dNewEnd").removeAttr("disabled");
        window['$']("#dNewEnd").css("background", "white");
        this.renewBody.dNewEnd = Util.dateIncrease(this.renewBody.dNewBegin, this.renewBody.sTermType);
      }
    }
  }
  // 续约必填
  requiredRenew() {
    let that = this;
    let requiredTip = [];
    if (this.renewBody.dNewBegin == '' || this.renewBody.dNewBegin == null) {
      requiredTip.push("新的开始日期");
    }
    if (this.renewBody.sTermType != '0' && (this.renewBody.dNewEnd == '' || this.renewBody.dNewEnd == null)) {
      requiredTip.push("新的到期日期");
    }
    if (requiredTip.length > 0) {
      let requiredTips = requiredTip.join("、");
      window['swal']("提示", "请填写:" + requiredTips, "warning");
      return false;
    } else {
      return true;
    }
  }
  // 续约保存
  saveRenew() {
    let that = this;
    // 续约为业务类型2
    this.renewBody.sType = 2;
    this.renewBody.sAuditStatus = 0;
    delete this.renewBody.isChecked;
    delete this.renewBody.sStopTypeZh;
    // 续约日期必填校验
    if (this.requiredRenew()) {
      if (Util.dateOrder(this.renewBody.dNewBegin, this.renewBody.dNewEnd)) {
        window['swal']({
          type: "warning",
          showCancelButton: true,
          confirmButtonText: "确认",
          cancelButtonText: "取消",
          closeOnConfirm: false,
          showLoaderOnConfirm: true,
          title: "提示",
          text: "是否确认进行续约修改?",
          html: true
        }, function (isConfirm) {
          if (isConfirm) {
            that.runningService.updateRenewTermination(that.renewBody).subscribe(data => {
              if (data) {
                window['$']("#renew").modal('hide');
                that.destroyAllModal('renewFileComponent');
                window['swal']("成功", "续约修改成功", "success");
                that.getRenewList();
              }
            })
          }
        })
      } else {
        window['swal']("提示", "新的到期日 须晚于 新的开始日期", "warning");
      }
    }
  }
  // 终止modal
  termination() {
    let that = this;
    let checkProduct = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked) {
        checkProduct.push(item);
      }
    })
    if (checkProduct.length == 1) {
      if (checkProduct[0].sAuditStatus == '' || checkProduct[0].sAuditStatus == null) {
        this.terminationBody = _.cloneDeep(checkProduct[0]);
        this.showTerminationFile(checkProduct[0]);
        window['$']("#termination").modal('show');
      } else {
        window['swal']("提示", "请选择审核状态为空的数据进行终止操作", "warning");
      }
    } else {
      window['swal']("提示", "请选择一条数据进行修改", "warning");
    }
  }
  // 终止组合文件模版
  showTerminationFile(item) {
    if (this.terminationFileComponent && this.terminationFileComponent.instance) {
      this.terminationFileComponent.destroy();
    }
    this.dataService.showUploadBtn = true;
    const terminationFileComponent = this.resolver.resolveComponentFactory(SocialFileComponent);
    this.terminationFileComponent = this.terminationFile.createComponent(terminationFileComponent);
    this.terminationFileComponent.instance.nFundNo = item.nFundNo;
    this.terminationFileComponent.instance.sAttachType = item.sAttachType;
    this.terminationFileComponent.instance.sAttachCode = item.sAttachCode;
  }
  // 终止必填
  requiredTermination() {
    if (this.terminationBody.dStopDate == '' || this.terminationBody.dStopDate == null) {
      window['swal']("提示", "终止日期不可为空", "warning");
      return false;
    } else {
      return true;
    }
  }
  // 终止保存
  saveTermination() {
    let that = this;
    // 终止为业务类型3
    this.terminationBody.sType = 3;
    this.terminationBody.sAuditStatus = 0;
    delete this.terminationBody.isChecked;
    if (this.requiredTermination()) {
      window['swal']({
        type: "warning",
        showCancelButton: true,
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        closeOnConfirm: false,
        showLoaderOnConfirm: true,
        title: "提示",
        text: "是否确认添加终止信息?",
        html: true
      }, function (isConfirm) {
        if (isConfirm) {
          that.runningService.updateRenewTermination(that.terminationBody).subscribe(data => {
            if (data) {
              window['$']("#termination").modal('hide');
              window['swal']("成功", "终止修改成功", "success");
              that.destroyAllModal('terminationFileComponent');
              that.getRenewList();
            }
          })
        }
      })
    }
  }
  // 续约/终止审核
  check() {
    let that = this;
    let checkProduct = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked == true) {
        checkProduct.push(item);
      }
    })
    if (checkProduct.length == 1) {
      // 判断业务类型是否存在,2为续约/3为终止
      if (checkProduct[0].sType == 2 || checkProduct[0].sType == 3) {
        // 判断是否为待审核状态
        if (checkProduct[0].sAuditStatus == 0) {
          // 判断是否为自动续约
          if (checkProduct[0].sType == 2 && checkProduct[0].sIsRenewal == 1 && (checkProduct[0].dNewBegin == '' || checkProduct[0].dNewBegin == null)) {
            window['swal']("提示", "请前往续约修改面板填写新的开始日期与新的到期日期", "warning");
            // 判断是否为自动终止
          } else if (checkProduct[0].sType == 3 && checkProduct[0].sIsRenewal == 0 && (checkProduct[0].dStopDate == '' || checkProduct[0].dStopDate == null)) {
            window['swal']("提示", "请前往终止修改面板填写终止日期", "warning");
          } else {
            this.checkBody = _.clone(checkProduct[0]);
            this.showCheckFile(checkProduct[0]);
            window['$']("#check").modal('show');
          }
        } else {
          window['swal']("提示", "请选择待审核状态的组合进行审核", "warning");
        }
      } else {
        window['swal']("提示", "请选择待审核状态的组合进行审核", "warning");
      }
    } else {
      window['swal']("提示", "请选择一条数据进行审核", "warning");
    }
  }
  // 审核通过
  checkPass() {
    let that = this;
    this.checkBody.sAuditStatus = 1;
    delete this.checkBody.isChecked;
    window['swal']({
      type: "warning",
      showCancelButton: true,
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      closeOnConfirm: false,
      showLoaderOnConfirm: true,
      title: "提示",
      text: "是否确认通过?",
      html: true
    }, function (isConfirm) {
      if (isConfirm) {
        that.runningService.checkRenew(that.checkBody).subscribe(data => {
          if (data) {
            window['$']("#check").modal('hide');
            window['swal']("成功", "审核通过", "success");
            that.getRenewList();
          }
        })
      }
    })
  }
  // 审核打回
  checkRepulse() {
    let that = this;
    this.checkBody.sAuditStatus = 2;
    delete this.checkBody.isChecked;
    window['swal']({
      type: "warning",
      showCancelButton: true,
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      closeOnConfirm: false,
      showLoaderOnConfirm: true,
      title: "提示",
      text: "是否确认打回?",
      html: true
    }, function (isConfirm) {
      if (isConfirm) {
        that.runningService.checkRenew(that.checkBody).subscribe(data => {
          if (data) {
            window['$']("#check").modal('hide');
            window['swal']("成功", "打回成功", "success");
            that.getRenewList();
          }
        })
      }
    })
  }
  // 续约/终止删除
  del() {
    let that = this;
    let checkedItem = [];
    let checkedStatus = [];
    let checkedFundName = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked == true) {
        checkedItem.push(item.nRenewTerminationNo);
        checkedStatus.push(item.sAuditStatus);
        checkedFundName.push(item.sFullName);
      }
    })
    let checkedTips = checkedFundName.join("、");
    if (_.includes(checkedStatus, '1')) {
      window['swal']("提示", "审核通过的数据不能删除", "warning");
    } else {
      if (checkedItem.length > 0) {
        window['swal']({
          type: "warning",
          showCancelButton: true,
          confirmButtonText: "确认",
          cancelButtonText: "取消",
          closeOnConfirm: false,
          showLoaderOnConfirm: true,
          title: "提示",
          text: "<div style='max-height: 200px;overflow-y: auto;'>" + "请确认是否删除：" + checkedTips + "组合" + "</div>",
          html: true
        }, function (isConfirm) {
          if (isConfirm) {
            let putBody: any = {
              "fundNoMap": checkedItem
            }
            that.runningService.delRenew(putBody).subscribe(data => {
              if (data) {
                window['swal']("删除成功！", "", "success")
                that.getRenewList();
              }
            })
          }
        })
      } else {
        window['swal']("提示", "请选择一个或多个数据进行删除", "warning");
      }
    }

  }
  // 续约/终止撤销
  cel() {
    let that = this;
    let checkProduct = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked == true) {
        checkProduct.push(item);
      }
    })
    if (checkProduct.length == 1) {
      if (checkProduct[0].sAuditStatus == 1) {
        let checkItem = _.clone(checkProduct[0]);
        checkItem.sAuditStatus = 0;
        delete checkItem.isChecked;
        window['swal']({
          type: "warning",
          showCancelButton: true,
          confirmButtonText: "确认",
          cancelButtonText: "取消",
          closeOnConfirm: false,
          showLoaderOnConfirm: true,
          title: "提示",
          text: "请确认是否撤销",
          html: true
        }, function (isConfirm) {
          if (isConfirm) {
            that.runningService.checkRenew(checkItem).subscribe(data => {
              if (data) {
                window['swal']("成功", "撤销成功", "success");
                that.getRenewList();
              }
            })
          }
        })
      } else {
        window['swal']("提示", "请选择审核通过的数据进行撤销", "warning");
      }
    } else {
      window['swal']("提示", "请选择一条数据进行撤销", "warning");
    }
  }
  // 续约/终止导出
  exportRenew() {
    let that = this;
    let checkedItem = [];
    _.forEach(this.renewList, item => {
      if (item.isChecked) {
        checkedItem.push(item.nRenewTerminationNo);
      }
    })
    let converItem: any = checkedItem.join(',');
    let getBody = {
      "renewTerminationNoList": converItem,
      "sFundType": this.getRenewPost.sFundType,
      "prdName": this.getRenewPost.prdName,
      "prdCode": this.getRenewPost.prdCode,
      "sType": this.getRenewPost.sType
    }
    const iframe = window['$']("<iframe id='downloadiframe'>");
    iframe.attr('style', 'display:none');
    //  转码，兼容ie
    getBody.prdName = encodeURI(getBody.prdName);
    iframe.attr('src', environment.server + '/pms/v1/pension/renewTerminationInfo/export/renewTerminationInfo?token=' + sessionStorage.getItem('token') + '&renewTerminationNoList=' + getBody.renewTerminationNoList + '&sFundType=' + getBody.sFundType + '&prdName=' + getBody.prdName + '&prdCode=' + getBody.prdCode + '&sType=' + getBody.sType);
    window['$']('body').append(iframe);
    setTimeout("$('#downloadiframe').remove()", 60000);
  }
  // 续约组合文件模版
  showRenewFile(item) {
    if (this.renewFileComponent && this.renewFileComponent.instance) {
      this.renewFileComponent.destroy();
    }
    this.dataService.showUploadBtn = true;
    const renewFileComponent = this.resolver.resolveComponentFactory(SocialFileComponent);
    this.renewFileComponent = this.renewFile.createComponent(renewFileComponent);
    this.renewFileComponent.instance.nFundNo = item.nFundNo;
    this.renewFileComponent.instance.sAttachType = item.sAttachType;
    this.renewFileComponent.instance.sAttachCode = item.sAttachCode;
  }
  // 终止组合文件模版
  // showTerminationFile(item) {
  //   if (this.terminationFileComponent && this.terminationFileComponent.instance) {
  //     this.terminationFileComponent.destroy();
  //   }
  //   this.dataService.showUploadBtn = true;
  //   const terminationFileComponent = this.resolver.resolveComponentFactory(SocialFileComponent);
  //   this.terminationFileComponent = this.terminationFile.createComponent(terminationFileComponent);
  //   this.terminationFileComponent.instance.nFundNo = item.nFundNo;
  //   this.terminationFileComponent.instance.sAttachType = item.sAttachType;
  //   this.terminationFileComponent.instance.sAttachCode = item.sAttachCode;
  // }
  // 续约/终止审核组合文件模版
  showCheckFile(item) {
    if (this.checkFileComponent && this.checkFileComponent.instance) {
      this.checkFileComponent.destroy();
    }
    this.dataService.showUploadBtn = false;
    const checkFileComponent = this.resolver.resolveComponentFactory(SocialFileComponent);
    this.checkFileComponent = this.checkFile.createComponent(checkFileComponent);
    this.checkFileComponent.instance.nFundNo = item.nFundNo;
    this.checkFileComponent.instance.sAttachType = item.sAttachType;
    this.checkFileComponent.instance.sAttachCode = item.sAttachCode;
  }
  //删除模态框
  destroyAllModal(item) {
    switch (item) {
      case 'renewFileComponent':
        this.renewFileComponent.destroy();
        break;
      case 'checkFileComponent':
        this.checkFileComponent.destroy();
        break;
      case 'terminationFileComponent':
        this.terminationFileComponent.destroy();
        break;
    }
    this.tabActive();
  }
  /**
  * 重置modal
  */
  tabActive() {
    window['$']("#tab8").removeClass('active');
    window['$']("#tab_8").removeClass('active');
    window['$']("#tabEightContent").attr('aria-expanded', "false");
    window['$']("#tab7").addClass('active');
    window['$']("#tab_7").addClass('active');
    window['$']("#tabSevenContent").attr('aria-expanded', "true");
    window['$']("#tab4").removeClass('active');
    window['$']("#tab_4").removeClass('active');
    window['$']("#tabFourContent").attr('aria-expanded', "false");
    window['$']("#tab3").addClass('active');
    window['$']("#tab_3").addClass('active');
    window['$']("#tabThridContent").attr('aria-expanded', "true");
    window['$']("#tab6").removeClass('active');
    window['$']("#tab_6").removeClass('active');
    window['$']("#tabSixContent").attr('aria-expanded', "false");
    window['$']("#tab5").addClass('active');
    window['$']("#tab_5").addClass('active');
    window['$']("#tabFiveContent").attr('aria-expanded', "true");
  }
  // 显示搜索模态框
  showQuery() {
    window['$']('#socialRunQuery').modal('show');
  }
  // 重置搜索
  resetQuery() {
    this.postBody.sFundCode = ''; //组合代码 
    this.postBody.sFullName = '';  //组合名称 
    this.postBody.sContractName = '';  //合同名称 
    this.postBody.sIsAssetTransfer = '0';  //是否资产移交
    this.postBody.sInvestor = '';
    //this.postBody.dSign = ''; //签约日期
    //this.postBody.dConfirm = ''; //确认日期
    this.postBody.sRecordorgType = ''; //备案机构
    this.postBody.sPlanNo = ''; //产品登记号
    this.postBody.sConfirmationNo = ''; //确认函号
    this.postBody.sEmissionObject = ''; //发行对象
    this.postBody.sEmissionWay = ''; //发行方式
    //this.postBody.dEffective = ''; //生效日期
    //this.postBody.dBegin = ''; //开始运作日期
    this.postBody.sTermType = ''; //期限 
    //this.postBody.dEnd = ''; //到期日
    this.postBody.sIsRenewal = ''; //是否自动续约
    this.postBody.sLinkPrincipalNo = ''; //受托人
    this.postBody.sManager = ''; //账管人
    this.postBody.sPrincipal = ''; //委托人
    this.postBody.sTrustee = ''; //托管人
    this.postBody.sOtherInvestor = ''; //其他投资管理人
    this.postBody.sProjectManager = ''; //项目经理
    this.postBody.sManagerNo = ''; //投资经理
    this.postBody.sBenchmark = ''; //业绩比较基准
    this.postBody.sArea = ''; //所属地区
    this.postBody.sIsContainRight = ''; //是否含权类
    // window['$']('#sRecordorgTypeSelected').select2("val", '--请选择--'); // 备案机构
    window['$']('#sTermTypeSelected').select2("val", '--请选择--'); // 期限
    window['$']('#sLinkPrincipalNoSelected').select2("val", '--请选择--'); // 受托人   
    // window['$']('#sManagerSelected').select2("val", '--请选择--'); // 账管人
    window['$']('#sTrusteeSelected').select2("val", '--请选择--'); // 托管人
    // window['$']('#sManagerNoSelected').select2("val", '--请选择--'); // 投资经理
    // window['$']('#sAreaSelected').select2("val", '--请选择--'); // 所属地区
    window['$']('#sProductTypeSelected').select2("val", '--请选择--'); // 组合类型
    window['$']('.sInvestor-select').select2("val", '--请选择--'); // 移交投管人
    window['$']('.investor-select').select2("val", '--请选择--'); // 其他投资管理人
    window['$']('.manager-select').select2("val", '--请选择--'); // 项目经理
  }
  // 是否资产移交控制
  IsAssetTransfer() {
    let that = this;
    if (this.postBody.sIsAssetTransfer == '0') {
      this.postBody.sInvestor = '';
      window['$']('.sInvestor-select').select2("val", '--请选择--'); // 移交投管人
    }
  }
  //获取基金经理下拉框数据
  LoadManagerList() {
    let that = this;
    that.runningService.getManagerList().subscribe(data => {
      if (data) {
        that.ManagerList = data;
      }
    });
  }
  //获取基金经理下拉框数据
  LoadProjectManagerList() {
    let that = this;
    that.runningService.getProjectManagerList().subscribe(data => {
      if (data) {
        that.ProjectManagerList = data;
      }
    });
  }
  // 移交投管人sInvestor
  ctrlsInvestor() {
    let investorList: any;
    let investorChecked = [];
    let selected = window['$']('.sInvestor-select').val();
    _.forEach(selected, item => {
      let index1 = item.indexOf("'");
      let index2 = item.lastIndexOf("'");
      let sales = item.substring(index1 + 1, index2);
      investorChecked.push(sales);
    })
    investorList = investorChecked.join(",");
    return investorList;
  }
  // 其他投资管理人
  ctrlInvestorId() {
    let investorIdList: any;
    let investorChecked = [];
    let selected = window['$']('.investor-select').val();
    _.forEach(selected, item => {
      let index1 = item.indexOf("'");
      let index2 = item.lastIndexOf("'");
      let sales = item.substring(index1 + 1, index2);
      investorChecked.push(sales);
    })
    investorIdList = investorChecked.join(",");
    return investorIdList;
  }
  // 项目经理
  ctrlManagerId() {
    let managerIdList: any;
    let managerChecked = [];
    let selected = window['$']('.manager-select').val();
    _.forEach(selected, item => {
      let index1 = item.indexOf("'");
      let index2 = item.lastIndexOf("'");
      let sales = item.substring(index1 + 1, index2);
      managerChecked.push(sales);
    })
    managerIdList = managerChecked.join(",");
    return managerIdList;
  }
  // 原是否自动续约,i为下标,sFullName为组合名称,nRenewTerminationNo为自增ID，sOldIsRenewal为续约方式
  changeOldIsRenewal(i, sFullName, nRenewTerminationNo, sOldIsRenewal) {
    let that = this;
    let tip: any;
    if (sOldIsRenewal == '0') {
      tip = '手工';
    } else if (sOldIsRenewal == '1') {
      tip = '自动';
    }
    window['swal']({
      type: "warning",
      showCancelButton: true,
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      closeOnConfirm: false,
      showLoaderOnConfirm: true,
      title: "提示",
      text: "是否确认 " + sFullName + " 的续约方式改为" + tip,
      html: true
    }, function (isConfirm) {
      if (isConfirm) {
        let putBody: any = {
          "nRenewTerminationNo": nRenewTerminationNo,
          "sOldIsRenewal": sOldIsRenewal
        }
        that.runningService.changeOldIsRenewal(putBody).subscribe(data => {
          if (data) {
            window['swal']("成功", '修改成功', "success")
            that.getRenewList();
          }
        })
      } else {
        // 取消更改，取原值付回
        that.renewList[i].sOldIsRenewal = _.cloneDeep(that.renewListClone[i].sOldIsRenewal);
      }
    })
  }
  // 点击表格头排序
  orderData(colName, dataList, dataListName) {
    let listDataAsc = _.orderBy(dataList, [colName], ["asc"]);
    if (JSON.stringify(dataList) == JSON.stringify(listDataAsc)) {
      listDataAsc = _.orderBy(dataList, [colName], ["desc"]);
    }
    switch (dataListName) {
      case 'socialList':
        this.socialList = listDataAsc;
        break;
      case 'renewList':
        this.renewList = listDataAsc;
        this.renewListClone = _.cloneDeep(listDataAsc);
        break;
    }
  }
  // OnAreaChg(event) {
  //   if (event[1] == '--请选择--' && event[0] != '--请选择--') {
  //     this.postBody.sArea = this.postBody.sArea + ',' + event[0]
  //   } else if (event[0] == '--请选择--') {
  //     this.postBody.sArea = '';
  //   } else {
  //     this.postBody.sArea = this.postBody.sArea + ',' + event[0] + "-" + event[1]
  //   }
  // }
  // OnAreaCodeChg(event) {
  //   this.postBody.sArea = event;
  // }
  // 获取备案机构、受托人、托管人下拉框值
  getDictionary() {
    let that = this;
    this.runningService.getDictionary().subscribe(data => {
      if (data) {
        that.distionary.RECORDORG_TYPE = data.RECORDORG_TYPE;
        that.distionary.LINK_PRINCIPAL_NO = data.LINK_PRINCIPAL_NO;
        that.distionary.TRUSTEE = data.TRUSTEE;
      }
    })
  }
}
